#include "StdAfx.h"
#include "Camera.h"

void Camera::Init()
{
	// Set up the matrixes
	m_viewMatrix.SetIdentity();

	// Hard-coded because I have no plan to extend further
	Matrix tmp;
	tmp.SetRotationX(PI/4.0f);								m_viewMatrix = m_viewMatrix * tmp;
	tmp.SetTranslation(0.0f, -10.0f, -40.0f);				m_viewMatrix = m_viewMatrix * tmp;

	m_projMatrix.SetPerspective(0.79, 1.0, 0.1, 10000);
}

void Camera::Move (float angle)
{
	Matrix tmp;
	tmp.SetTranslation(0.0f, 10.0f, 40.0f);			m_viewMatrix = m_viewMatrix * tmp;
	tmp.SetRotationX(-PI/4.0f);						m_viewMatrix = m_viewMatrix * tmp;
	tmp.SetRotationY(angle);						m_viewMatrix = m_viewMatrix * tmp;
	tmp.SetRotationX(PI/4.0f);						m_viewMatrix = m_viewMatrix * tmp;
	tmp.SetTranslation(0.0f, -10.0f, -40.0f);		m_viewMatrix = m_viewMatrix * tmp;
}

Matrix Camera::GetMatrix()
{
	return m_viewMatrix * m_projMatrix;
}